// store/modules/uploadDialog.ts
import { defineStore } from 'pinia';

export const useUploadDialogStore = defineStore('uploadDialog', {
  state: () => ({
    dialogRef: null as null | { showProgress: () => void; hideProgress: () => void },
    fileData: null as Record<string, any> | null,
  }),
  actions: {
    setDialogRef(ref: any) {
      this.dialogRef = ref;
    },
    openDialog(fileData: Record<string, any>) {
      this.fileData = fileData; // 设置文件信息
      this.dialogRef?.showProgress();
    },
    closeDialog() {
      this.fileData = null;
      this.dialogRef?.hideProgress();
    },
  },
});
